package com.dg.dto;

import com.dg.common.Const;
import com.dg.pojo.User;
import lombok.*;
import org.springframework.beans.BeanUtils;

import java.util.Date;

@Data
public class UserDto {

    private Integer id;

    private String username;

    private String phone;

    private String password;

    private String deptName;

    private String status;

    private String remark;

    private String operator;

    private Date operateTime;

    private String operateIp;

    private String roles;

    public static UserDto adapt(User user){
        UserDto userDTO = new UserDto();
        BeanUtils.copyProperties(user, userDTO);
        userDTO.setStatus(Const.StatusEnum.codeOf(user.getStatus()).getValue());
        return userDTO;
    }



}
